xen/x86: domctl: Don't leak data via XEN_DOMCTL_gethvmcontext
authorJulien Grall <jgrall@amazon.com>
Thu, 5 Mar 2020 10:32:53 +0000 (11:32 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 5 Mar 2020 10:32:53 +0000 (11:32 +0100)
commit5abd2611893fc1c0a4ab642b5a1effa56186abad
treeb509aa9ebc3f0fb440a7a36f7d232f6e673356c2
parentb187c14ada3065c0b317c70cc97f27035edd0bc8
xen/x86: domctl: Don't leak data via XEN_DOMCTL_gethvmcontext

The HVM context may not fill up the full buffer passed by the caller.
While we report corectly the size of the context, we will still be
copying back the full size of the buffer.

As the buffer is allocated through xmalloc(), we will be copying some
bits from the previous allocation.

Only copy back the part of the buffer used by the HVM context to prevent
any leak.

Note that per XSA-72, this is not a security issue.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 41d8869003e96d8b7250ad1d0246371d6929aca6
master date: 2020-01-31 18:51:38 +0000
xen/arch/x86/domctl.c